Skip to content

Get Flake8 looking clean #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed

Conversation

gsnedders
Copy link
Member

This addresses both pyflakes and pep8. See commit messages for more detail. In fixing this, this fixes #1.

This is mostly just removing dead variables, however, there are a few
substantial changes in here:

 - Move to using try/except ImportError/else in tests where we are
   checking some module existing, as this was hiding genuine bugs
   that manifested themselves as ImportError (the etree treewalker was
   throwing ImportError when being imported).

 - Fixes the ImportError the etree treewalker was throwing (this was,
   too, reported as a bug by pyflakes, thereby showing its
   value). However, given it has been untested for a while, it is
   unsurprisingly broken, failing thousands of tests.

 - The parser defined the scriptDataDoubleEscapedDashState twice,
   therefore everything that should've been run in this state was in
   fact run in the scriptDataDoubleEscapedDashDashState.

This also adds flake8 to Travis, albeit running it without any PEP 8
errors showing.
The two violations:

 - We don't in general comply with the 79 character per line limit.

 - constants.py violates (at least according to pep8) the hanging
   indent rule. On the whole, I disagree with the tool and have filed
   <PyCQA/pycodestyle#189> with regards to
   this.
This is effectively the treewalker equivalent of 3e50aad:

    Don't rely on the ElementTree Comment factory being the tag
    attribute on Comments.

    This is needed for xml.etree.cElementTree under 2.6 (and likely
    hence custom installs of cElementTree 1.2), where the tag property
    is equal to xml.etree.ElementTree.Comment (i.e., the pure Python
    version).
It turns out flake8's behaviour differs between Python 2 and Python 3
because of the changes between the two, so run it on both on Travis.
@ghost ghost assigned gsnedders Apr 27, 2013
@gsnedders
Copy link
Member Author

Manually merged in 5b94a06 and immediate parents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pyflakes finds a lot of issues in html5lib (some critical like the "undefined" ones at the bottom)
1 participant